package com.loveyukari.controller;

import com.loveyukari.service.RedisService;
import com.loveyukari.service.WeixinService;
import com.loveyukari.support.JsonResult;
import com.loveyukari.utils.HttpUtils;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;
import java.util.concurrent.TimeUnit;

@Controller
@RequestMapping("/weixin")
public class WeixinController {

    @Autowired
    private WeixinService weixinService;

    Logger logger = LoggerFactory.getLogger(WeixinController.class);

    @RequestMapping("/receive")
    @ResponseBody
    public String token(@RequestBody String a){
        logger.info(a);
        return "{}";

    }


    public static void main(String[] args) {
        String a = "{\"URL\":\"https://www.loveyukari.com/yukari/weixin/receive\",\"ToUserName\":\"kaifazhe\",\"FromUserName\":\"fasongfang\",\"CreateTime\":12312321,\"MsgType\":\"text\",\"Content\":\"测试一下\",\"MsgId\":1234567890123123123123}";
        JSONObject b = JSONObject.fromObject(a);
        System.out.println(b.optLong("MsgId"));
    }







}
